<?php

namespace App\Services\Admin;

use App\Lib\Util\ErrorCode;
use App\Models\Admin\DemoModel;

/**
 * Class DemoService
 * @package App\Services\Admin
 */
class DemoService
{
    private $DemoModel;

    public function __construct(DemoModel $DemoModel)
    {
        $this->DemoModel = $DemoModel;

    }
    /**
     * @param $id
     * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object
     * @throws \Exception
     */
    public function getDemoInfo($id)
    {

        $arrDemo = $this->DemoModel->query()->where('id', $id)->first();
        if(empty($arrDemo)){
            throw new \Exception('',ErrorCode::NO_DATA);
        }
        return $arrDemo;
    }
}
